<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>菜单管理</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link href="/resources/css/base.css" rel="stylesheet"
	type="text/css" />
<link href="/resources/js/miniui/themes/default/miniui.css"
	rel="stylesheet" type="text/css" />
<script src="/resources/js/jquery-1.6.2.min.js"
	type="text/javascript"></script>
<script src="/resources/js/miniui/miniui.js"
	type="text/javascript"></script>
</head>
<body>
	<h1>系统设置</h1>

	<div id="editform" class="form">
		<input class="mini-hidden" name="id" value="0" />
		<table style="width: 100%;">
			<tr>
				<td style="width: 30%; text-align: right;">登陆错误次数：</td>
				<td style="width: 70%; text-align: left;"><input
					name="errorCount" class="mini-textbox" maxLength=2 /></td>
			</tr>
			<tr>
				<td style="width: 30%; text-align: right;">默认密码：</td>
				<td style="width: 70%; text-align: left;"><input
					name="defaultPwd" class="mini-textbox" maxLength=200 /></td>
			</tr>
			<tr>
				<td style="width: 30%; text-align: right;">联系QQ：</td>
				<td style="width: 70%; text-align: left;"><input name="qq"
					class="mini-textbox" maxLength=20 /></td>
			</tr>
			<tr>
				<td style="width: 30%; text-align: right;">联系电话：</td>
				<td style="width: 70%; text-align: left;"><input name="tel"
					class="mini-textbox" maxLength=20 /></td>
			</tr>
			<tr>
				<td style="width: 30%; text-align: right;">联系微信：</td>
				<td style="width: 70%; text-align: left;"><input name="wechat"
					class="mini-textbox" maxLength=20 /></td>
			</tr>
			<tr>
				<td style="width: 30%; text-align: right;">联系邮件：</td>
				<td style="width: 70%; text-align: left;"><input name="mail"
					class="mini-textbox" maxLength=20 /></td>
			</tr>
			<tr>
				<td style="width: 30%; text-align: right;"></td>
				<td
					style="width: 70%; text-align: left; padding-top: 5px; padding-right: 20px;"
					colspan="6"><a class="mini-button saveRow"
					img="/resources/js/miniui/themes/icons/save.gif">保存</a></td>
			</tr>

		</table>
	</div>

</body>
<script type="text/javascript">
	$(function() {

		mini.parse();
		var form = new mini.Form("editform");

		$.ajax({
			url : "/systemSetting/get",
			type : "post",
			dataType : "json",
			success : function(data) {
				form.clear();
				console.log(data);
				console.log(data.data);
				form.setData(data.data);
			},
			error : function(jqXHR, textStatus, errorThrown) {
				alert(jqXHR.responseText);
			}
		});

		$('.saveRow').bind('click', function saveRow() {
			var json = form.getData();
			console.log(json.id);
			if (json.id == 'undefined' || json.id == '') {
				json.id = 0;
			}
			console.log(json);
			$.ajax({
				url : "/systemSetting/update",
				data : json,
				type : "post",
				success : function(text) {
					mini.alert("保存成功!");
					form.setData(json);
				},
				error : function(jqXHR, textStatus, errorThrown) {
					alert(jqXHR.responseText);
				}
			});
		})

	})
</script>

</html>
